home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume91 / devices / yes_1_0 / part01 / misc.c < prev    next >
C/C++ Source or Header  |  1991-05-08  |  2KB  |  79 lines

  1. /*
  2.  *  misc.c  - support routines - Phillip Lindsay (C) Commodore 1986
  3.  *  You may freely distribute this source and use it for Amiga Development -
  4.  *  as long as the Copyright notice is left intact.
  5.  *
  6.  * 30-SEP-86
  7.  *
  8.  */
  9. #include <stdio.h>
  10. #include <exec/types.h>
  11. #include <exec/nodes.h>
  12. #include <exec/lists.h>
  13. #include <exec/ports.h>
  14. #include <exec/libraries.h>
  15. #include <exec/devices.h>
  16. #include <exec/io.h>
  17. #include <exec/memory.h>
  18. #include <devices/console.h>
  19. #include <libraries/dos.h>
  20. #include <libraries/dosextens.h>
  21. #include <libraries/filehandler.h>
  22.  
  23. #include <proto/exec.h>
  24.  
  25. extern void returnpkt();
  26.  
  27. /* returnpkt() - packet support routine
  28.  * here is the guy who sends the packet back to the sender...
  29.  *
  30.  * (I modeled this just like the BCPL routine [so its a little redundant] )
  31.  */
  32.  
  33.  
  34.  
  35.  
  36. void
  37. returnpkt(struct DosPacket *packet,struct Process *myproc, ULONG res1, ULONG res2);
  38.  
  39.  
  40.  
  41. void
  42. returnpkt(struct DosPacket *packet,struct Process *myproc, ULONG res1, ULONG res2)
  43. {
  44.     struct Message *mess;
  45.     struct MsgPort *replyport;
  46.  
  47.     packet->dp_Res1          = res1;
  48.     packet->dp_Res2          = res2;
  49.     replyport                = packet->dp_Port;
  50.     mess                     = packet->dp_Link;
  51.     packet->dp_Port          = &myproc->pr_MsgPort;
  52.     mess->mn_Node.ln_Name    = (char *) packet;
  53.     mess->mn_Node.ln_Succ    = NULL;
  54.     mess->mn_Node.ln_Pred    = NULL;
  55.     PutMsg(replyport, mess);
  56. }
  57.  
  58.  
  59. struct DosPacket *
  60. taskwait(struct MsgPort *);
  61. /*
  62.  * taskwait() ... Waits for a message to arrive at your port and
  63.  *   extracts the packet address which is returned to you.
  64.  */
  65.  
  66. struct DosPacket *
  67. taskwait(struct MsgPort *myport)
  68. {
  69.     struct Message *mymess;
  70.  
  71.     WaitPort(myport);
  72.     mymess = GetMsg(myport);
  73.     return((struct DosPacket *)mymess->mn_Node.ln_Name);
  74. }
  75.  
  76. /* end of misc.c    */
  77.  
  78.  
  79.